package com.xjgzinfo.usdp.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 大屏页面配置
 *
 * @author jxw
 */
@Entity
@Table(name = "blade_visual_config")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class BladeVisualConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "snowFlakeIdGenerator", strategy = "com.xjgzinfo.usdp.domain.util.SnowFlakeIdGenerator")
    @GeneratedValue(generator = "snowFlakeIdGenerator", strategy = GenerationType.SEQUENCE)
    @JsonFormat(shape = JsonFormat.Shape.NUMBER)
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 可视化表主键
     */
    @NotNull
    @Column(name = "visual_id", nullable = false)
    private Long visualId;

    /**
     * 配置json
     */

    @Lob
    @Column(name = "detail", nullable = false)
    private String detail;

    /**
     * 组件json
     */

    @Lob
    @Column(name = "component", nullable = false)
    private String component;

    // jhipster-needle-entity-add-field - JHipster will add fields here
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getVisualId() {
        return visualId;
    }

    public void setVisualId(Long visualId) {
        this.visualId = visualId;
    }

    public BladeVisualConfig visualId(Long visualId) {
        this.visualId = visualId;
        return this;
    }

    public BladeVisualConfig detail(String detail) {
        this.detail = detail;
        return this;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public BladeVisualConfig component(String component) {
        this.component = component;
        return this;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof BladeVisualConfig)) {
            return false;
        }
        return id != null && id.equals(((BladeVisualConfig) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    // prettier-ignore


    @Override
    public String toString() {
        return "BladeVisualConfig{" +
                "id=" + id +
                ", visualId=" + visualId +
                ", detail='" + detail + '\'' +
                ", component='" + component + '\'' +
                '}';
    }
}
